package com.mlf.builder;

import com.mlf.builder.computer.Computer;
import com.mlf.builder.computer.ComputerDirector;
import com.mlf.builder.computer.OfficeComputerBuilder;
import org.junit.Test;
import org.springframework.beans.BeanUtils;


public class BuilderPatternDemo {
    public static void main(String[] args) {
        ComputerDirector director = new ComputerDirector();
      //  GamingComputerBuilder builder = new GamingComputerBuilder();
        OfficeComputerBuilder builder = new OfficeComputerBuilder();
        Computer computer = director.construct(builder);
        System.out.println(computer);
        BeanUtils.copyProperties(computer, new Computer());

    }


    @Test
    public void linkTest() {
        Computer computer = new Computer.Builder()
                .cpu("i7")
                .ram("16GB")
                .storage("512GB SSD")
                .build();
        System.out.println(computer);

        StringBuilder stringBuilder = new StringBuilder().append("1").append("2");
        StringBuffer stringBuffer = new StringBuffer().append("0").append("1");
        System.out.println("stringBuilder = " + stringBuilder);
        System.out.println("stringBuffer = " + stringBuffer);
    }
}
